package com.ruoyi.web.controller.common;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.ClassifyEnum;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author zhutianyu
 * @date 2021/8/19 16:57
 */
@Api(value = "枚举控制器", tags = {"枚举"})
@RestController
@RequestMapping("/enum")
public class EnumController {

    @GetMapping("classifyEnum")
    public AjaxResult<List<Map<String, String>>> classifyEnum() {
        List<Map<String, String>> list = new ArrayList<>();
        for (ClassifyEnum classifyEnum : ClassifyEnum.values()) {
            Map<String, String> map = new HashMap<>(2);
            map.put("value", classifyEnum.getValue());
            map.put("label", classifyEnum.getLabel());
            list.add(map);
        }
        return AjaxResult.success(list);

    }

}
